unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Graphics, Controls, Forms, Dialogs,
  Classes,Wininet, MPlayer,xpman, ComCtrls, StdCtrls,mmSystem,RegExpr,
  ExtCtrls, procedures,inifiles;

type
  TForm1 = class(TForm)
    ProgressBar1: TProgressBar;
    Button1: TButton;
    Button2: TButton;
    Memo1: TMemo;
    ListBox1: TListBox;
    XPManifest1: TXPManifest;
    procedure FormResize(Sender: TObject);
    procedure FormStartDock(Sender: TObject;
      var DragObject: TDragDockObject);
    procedure FormGetSiteInfo(Sender: TObject; DockClient: TControl;
      var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
    procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
      WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var

  Form1: TForm1;

implementation

uses StrUtils, ArrayS, TestForm, authorization;

{$R *.dfm}


procedure parsePage(page:ansistring);
var   r : TRegExpr;
nam,url:string;
i:integer;
begin
i:=0;
  r := TRegExpr.Create;
  try
     r.Expression := '(?-g)<div class="audioRow" id="audio([0-9]*)".*operate\(([0-9]*),([0-9]*),([0-9]*),''([a-z0-9]*)'',([0-9]*).*id="performer[0-9]*">([^<]*)</b> - .*title[0-9]*">([^<]*)<';
     if r.Exec (page) then 
     repeat
     //http://cs1445.vkontakte.ru/u2113953/audio/7e3841ee56.mp3
     //operate(3-36859119,1445,2113953,'7e3841ee56',235);
      nam:=StringReplace(r.Match[7]+' - '+r.Match[8],' ',' ',[rfReplaceAll]);
      nam:=StringReplace(nam,#10,'',[rfReplaceAll]);
      nam:=StringReplace(nam,#13,'',[rfReplaceAll]);
      nam:=StringReplace(nam,'&amp;','&',[rfReplaceAll]);
      url:='http://cs'+r.Match[3]+'.vkontakte.ru/u'+r.Match[4]+'/audio/'+r.Match[5]+'.mp3';
      Form1.ListBox1.AddItem(nam+url,Form1.ListBox1);

      inc(i);
   {   with songi[i] do begin
      title:=nam;
      url:=url;
      localfile:='';
      lab:=TLabel.Create(form1);
      lab.Caption:=nam;
      lab.Left:=10;
      lab.top:=i*15;
      lab.Transparent:=true;
      lab.Visible:=true;
     // lab.Parent:=Form1; 
       end;         }

       until not r.ExecNext;
    finally r.Free;
    end;
  // showmessage(inttostr(Form1.ListBox1.Count));
end;

procedure TForm1.FormResize(Sender: TObject);
begin
form1.Repaint;
end;

procedure TForm1.FormStartDock(Sender: TObject;
  var DragObject: TDragDockObject);
begin
MessageBeep(0);
end;

procedure TForm1.FormGetSiteInfo(Sender: TObject; DockClient: TControl;
  var InfluenceRect: TRect; MousePos: TPoint; var CanDock: Boolean);
begin
MessageBeep(0);
end;

procedure TForm1.FormMouseWheel(Sender: TObject; Shift: TShiftState;
  WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
begin
//showmessage(inttostr(   form1.vertScrollBar.Position));
form1.vertScrollBar.Position:= form1.vertScrollBar.Position-(WheelDelta div 5);
end;

end.
